<template>
    <div>
        <h3>Inject Test</h3>
        <pre>
            <code>
                在plugins目录下添加vue-inject.js,写入下面代码:
                export default function ({},inject) {
                    const apis = {};
                    apis.myInjectedFunction = string => console.log('This is an example', string)
                    inject('myInjectApi', apis);
                }
                使用示例参看mounted处调用！
            </code>
        </pre>
    </div>
   
</template>

<script>

export default {
    name: "InjectIndexPage",
    // layout: 'test', //默认的使用default.vue
    asyncData(context) {
        // called every time before loading the component
    },
    fetch() {
        // The fetch method is used to fill the store before rendering the page
    },
    head() {
        // Set Meta Tags for this Page
    },
    mounted () {
    this.$myInjectApi.myInjectedFunction('for test injected function')
  },
    components: { }
}
</script>
